<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>怡臣 | 店铺管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <!--link rel="stylesheet" href="/Public/admin/adminlte/plugins/ionicons/ionicons.min.css"-->
    <!-- Theme style -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/morris/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/daterangepicker/daterangepicker.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!-- common css -->
    <link rel="stylesheet" href="/Public/admin/css/common.css">
    <!-- jQuery 2.2.3 -->
    <script src="/Public/admin/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="/Public/admin/adminlte/bootstrap/js/jquery-ui.min.js"></script>
    <script src="/Public/admin/js/jquery.validate.min.js"></script>
    <script src="/Public/admin/js/jquery.validate.config.js"></script>
    <script src="/Public/admin/js/common.js?v=20170317001"></script>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/Public/admin/adminlte/plugins/html5shiv/html5shiv.min.js"></script>
    <script src="/Public/admin/adminlte/plugins/html5shiv/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <header class="main-header">
        <!-- Logo -->
        <a href="" class="logo">
            <span class="logo-mini"><b>怡臣</b></span>
            <span class="logo-lg"><b>怡臣店铺</b>管理</span>
        </a>
        <nav class="navbar navbar-static-top">
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            </a>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown notifications-menu">
                        <a href="/Public/download/images.zip" class="dropdown-toggle">
                            <span class="hidden-xs">图片包下载</span>
                        </a>
                    </li>
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="/Public/admin/adminlte/dist/img/store-face.png" class="user-image"
                                 alt="User Image">
                            <span class="hidden-xs"><?php echo session('userInfo')['username']?></span>
                        </a>
                    </li>
                    <li class="dropdown notifications-menu">
                        <a href="<?php echo U('admin/login/loginOut');?>" class="dropdown-toggle">
                            <i class="fa fa-bell-o">退出</i>
                            <span class="label label-warning">~</span>
                        </a>
                    </li>
                    <li class="dropdown notifications-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                            <i class="fa fa-bell-o">订单消息</i>
                            <span class="label label-warning order_msg"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <!--<li class="header">清空全部</li>-->
                            <li>
                                <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 200px;">
                                    <ul class="menu order-ul-msg" style="width: 100%; height: 200px;">

                                    </ul>
                                    <div class="slimScrollBar" style="background: rgb(0, 0, 0); width: 3px; position: absolute; top: 0px; opacity: 0.4; display: none; border-radius: 7px; z-index: 99; right: 1px; height: 195.122px;"></div>
                                    <div class="slimScrollRail" style="width: 3px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; background: rgb(51, 51, 51); opacity: 0.2; z-index: 90; right: 1px;"></div>
                                </div>
                            </li>
                            <li class="footer"><a href="<?php echo U('admin/Orders/orderList');?>">查看全部订单</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>

<!-- Left logo -->
<?php
if (session('userInfo')['type'] == 1) { ?>
<aside class="main-sidebar">
    <section class="sidebar">
        <!-- 导航页面 -->
        <ul class="sidebar-menu">


            <li class="<?php echo CONTROLLER_NAME == 'Index' ? 'active' : ''; ?> treeview">
                <a href="<?php echo U('Admin/index/index');?>">
                    <i class="fa fa-dashboard"></i> <span>后台首页</span>
                </a>
            </li>

            <li class="treeview <?php echo CONTROLLER_NAME == 'Purchase' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>采购</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('Purchase/index');?>"><i class="fa fa-circle-o"></i> 采购商品列表</a></li>
                    <li class="<?php if(ACTION_NAME == shoppingCart): ?>active<?php endif; ?>"><a href="<?php echo U('Purchase/shoppingCart');?>"><i class="fa fa-circle-o"></i> 我的采购计划</a></li>
                    <li class="<?php if(ACTION_NAME == shoppingList): ?>active<?php endif; ?>"><a href="<?php echo U('Purchase/shoppingList');?>"><i class="fa fa-circle-o"></i> 我的采购单</a></li>
                </ul>
            </li>
            <li class="<?php echo CONTROLLER_NAME == 'Page' || CONTROLLER_NAME == 'ShortcutMenu' || CONTROLLER_NAME == 'Carousel' || CONTROLLER_NAME == 'Search' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>首页管理</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="/Admin/carousel/index"><i class="fa fa-circle-o"></i> 轮播图管理</a></li>
                    <li><a href="/Admin/ShortcutMenu/index"><i class="fa fa-circle-o"></i> 图标栏目管理</a></li>
                    <li><a href="/Admin/Page/index"><i class="fa fa-circle-o"></i> 首页促销</a></li>
                    <li><a href="/Admin/Page/recommend"><i class="fa fa-circle-o"></i> 商品推荐</a></li>
                    <li><a href="<?php echo U('Search/index');?>"><i class="fa fa-circle-o"></i> 搜索关键字</a></li>
                    <li><a href="<?php echo U('Artice/index');?>"><i class="fa fa-circle-o"></i> 文章管理</a></li>
                </ul>
            </li>
            <li class="<?php if(CONTROLLER_NAME == Weixin or CONTROLLER_NAME == Poster): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>微信设置</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(CONTROLLER_NAME == index): ?>active<?php endif; ?>"><a href="/Admin/Weixin/index"><i class="fa fa-circle-o"></i> 微信消息模板</a></li>
                </ul>
            </li>
            <li class="<?php echo CONTROLLER_NAME == 'Letter' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>短信设置</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(CONTROLLER_NAME == index): ?>active<?php endif; ?>"><a href="/Admin/Letter/index"><i class="fa fa-circle-o"></i> 短信模板</a></li>
                </ul>
            </li>
            <li class="treeview <?php echo CONTROLLER_NAME == 'Label' || CONTROLLER_NAME == 'StoreGoods' || CONTROLLER_NAME == 'StoreCat' || CONTROLLER_NAME == 'StoreDot' || CONTROLLER_NAME == 'Store' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-laptop"></i>
                    <span>商品管理</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('/Admin/StoreCat/index');?>"><i class="fa fa-circle-o"></i> 商品分类</a></li>
                    <li><a href="<?php echo U('/Admin/StoreGoods/index');?>"><i class="fa fa-circle-o"></i> 商品配置</a></li>
                    <li><a href="<?php echo U('/Admin/StoreGoods/putaway');?>"><i class="fa fa-circle-o"></i> 上架商品管理</a></li>
                    <li><a href="<?php echo U('/Admin/Label/index');?>"><i class="fa fa-circle-o"></i> 商品标签</a></li>
                </ul>
            </li>
            <li class="treeview <?php echo CONTROLLER_NAME == 'Rbac' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-edit"></i> <span>权限设置</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('Admin/Rbac/user');?>"><i class="fa fa-circle-o"></i> 账号</a></li>
                    <li><a href="<?php echo U('Admin/Rbac/role');?>"><i class="fa fa-circle-o"></i> 角色</a></li>
                    <li><a href="<?php echo U('Admin/Rbac/menu');?>"><i class="fa fa-circle-o"></i> 菜单</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Orders or CONTROLLER_NAME == QgsOrders): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-table"></i> <span>订单</span>
                    <span class="pull-right-container">
                      <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('Orders/orderList');?>"><i class="fa fa-circle-o"></i> 订单列表</a></li>
                    <li><a href="<?php echo U('QgsOrders/orderList');?>"><i class="fa fa-circle-o"></i> 全国送会员订单</a></li>
                </ul>
            </li>

            <li class="treeview <?php if(CONTROLLER_NAME == Giftcode or CONTROLLER_NAME == OrderPromotion or CONTROLLER_NAME == Promotion or CONTROLLER_NAME == DiscountCoupon or CONTROLLER_NAME == Flashsales): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>营销</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a> 
                <ul class="treeview-menu">
                    <li class="<?php if(CONTROLLER_NAME == DiscountCoupon): ?>active<?php endif; ?>"><a href="<?php echo U('DiscountCoupon/index');?>"><i class="fa fa-circle-o"></i> 优惠券</a></li>
                    <li class="<?php if(CONTROLLER_NAME == GoodsPromotion): ?>active<?php endif; ?>"><a href="<?php echo U('GoodsPromotion/index');?>"><i class="fa fa-circle-o"></i> 商品促销</a></li>
                    <li class="<?php if(CONTROLLER_NAME == OrderPromotion): ?>active<?php endif; ?>"><a href="<?php echo U('OrderPromotion/index');?>"><i class="fa fa-circle-o"></i> 订单促销</a></li>
                    <li class="<?php if(ACTION_NAME == group): ?>active<?php endif; ?>"><a href="<?php echo U('Promotion/group');?>"><i class="fa fa-circle-o"></i> 组合促销</a></li>
                    <li class="<?php if(CONTROLLER_NAME == Flashsales): ?>active<?php endif; ?>"><a href="<?php echo U('Flashsales/index');?>"><i class="fa fa-circle-o"></i> 限时抢购</a></li>
                    <li class="<?php if(CONTROLLER_NAME == Giftcode): ?>active<?php endif; ?>"><a href="<?php echo U('Giftcode/index');?>"><i class="fa fa-circle-o"></i> 领券中心</a></li>
                    <!--<li><a href="pages/tables/simple.html"><i class="fa fa-circle-o"></i> 商品发现</a></li>-->
                </ul>                
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Special): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>活动专题</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a> 
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index or ACTION_NAME == template): ?>active<?php endif; ?>"><a href="<?php echo U('special/index');?>"><i class="fa fa-circle-o"></i> 专题列表</a></li>
                    <li class="<?php if(ACTION_NAME == index or ACTION_NAME == template): ?>active<?php endif; ?>"><a href="<?php echo U('special/advert');?>"><i class="fa fa-circle-o"></i> 专题广告</a></li>
                    <li class="<?php if(ACTION_NAME == cart): ?>active<?php endif; ?>"><a href="<?php echo U('special/cart');?>"><i class="fa fa-circle-o"></i> 专题商品包</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Storesetup or CONTROLLER_NAME == Freight or CONTROLLER_NAME == Delivery or CONTROLLER_NAME == Dlycorp or CONTROLLER_NAME == StoreSetup): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>店铺配置</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == dlytmp): ?>active<?php endif; ?>"><a href="<?php echo U('freight/dlytmp');?>"><i class="fa fa-circle-o"></i> 快递运费模板</a></li>
                    <li class="<?php if(ACTION_NAME == dlyyctmp): ?>active<?php endif; ?>"><a href="<?php echo U('freight/dlyyctmp');?>"><i class="fa fa-circle-o"></i> 店铺运费模板</a></li>
                    <li class="<?php if(ACTION_NAME == dlycorp): ?>active<?php endif; ?>"><a href="<?php echo U('Dlycorp/dlycorp');?>"><i class="fa fa-circle-o"></i>
                         物流公司</a></li>
                    <li class="<?php if(ACTION_NAME == deliveryInfo): ?>active<?php endif; ?>"><a href="<?php echo U('Delivery/deliveryInfo');?>"><i class="fa fa-circle-o"></i> 发货信息管理</a></li>
                    <li class="<?php if(ACTION_NAME == printer): ?>active<?php endif; ?>"><a href="<?php echo U('Delivery/printer');?>"><i class="fa fa-circle-o"></i> 快递单模板</a></li>
                    <li class="<?php if(CONTROLLER_NAME == Storesetup): ?>active<?php endif; ?>"><a href="<?php echo U('Storesetup/index');?>"><i class="fa fa-circle-o"></i> 店铺基础信息</a></li>
                    <li><a href="<?php echo U('/Admin/StoreDot/index');?>"><i class="fa fa-circle-o"></i> 自提点管理</a></li>
                </ul>
            </li>



            <li class="treeview <?php if(CONTROLLER_NAME == Refund or CONTROLLER_NAME == Feedback): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-folder"></i> <span>售后</span>
                    <span class="pull-right-container">
                      <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('Refund/index',array('view'=>1));?>"><i class="fa fa-circle-o"></i> 退款退货</a></li>
                    <li><a href="<?php echo U('MemberComplain/index');?>"><i class="fa fa-circle-o"></i> 投诉</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == User or CONTROLLER_NAME == index): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-share"></i> <span>会员</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('User/index');?>"><i class="fa fa-circle-o"></i> 会员列表</a></li>
                    <li class="<?php if(ACTION_NAME == tempUser): ?>active<?php endif; ?>"><a href="<?php echo U('User/tempUser');?>"><i class="fa fa-circle-o"></i> 游客列表</a></li>
                </ul>
            </li>

            <li class="treeview <?php if(CONTROLLER_NAME == StoreOrderSales or CONTROLLER_NAME == StoreGoodsSales or CONTROLLER_NAME == StoreRefund or CONTROLLER_NAME == StoreItemSell or CONTROLLER_NAME == StatisticalLogistics): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>统计</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == orderSale): ?>active<?php endif; ?>"><a href="<?php echo U('StoreOrderSales/orderSale');?>"><i class="fa fa-circle-o"></i> 订单统计</a></li>

                    <li class="<?php if(ACTION_NAME == StaticalSet): ?>active<?php endif; ?>"><a href="<?php echo U('StatisticalLogistics/StaticalSet');?>"><i class="fa fa-circle-o"></i> 物流统计</a></li>
                    <li class="<?php if(ACTION_NAME == goodsSale): ?>active<?php endif; ?>"><a href="<?php echo U('StoreGoodsSales/goodsSale');?>"><i class="fa fa-circle-o"></i> 商品统计</a></li>
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('StoreRefund/index');?>"><i class="fa fa-circle-o"></i> 退款统计</a></li>

                </ul>
            </li>

            <li class="treeview <?php if(CONTROLLER_NAME == StatisticsUser): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>会员统计</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == day): ?>active<?php endif; ?>"><a href="<?php echo U('StatisticsUser/day');?>"><i class="fa fa-circle-o"></i> 会员统计(天)</a></li>
                    <li class="<?php if(ACTION_NAME == month): ?>active<?php endif; ?>"><a href="<?php echo U('StatisticsUser/month');?>"><i class="fa fa-circle-o"></i> 会员统计(月)</a></li>
                    <li class="<?php if(ACTION_NAME == newUser): ?>active<?php endif; ?>"><a href="<?php echo U('StatisticsUser/newUser');?>"><i class="fa fa-circle-o"></i> 新增会员统计</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Distribution or CONTROLLER_NAME == Poster): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>分销</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == setMoney): ?>active<?php endif; ?>"><a href="<?php echo U('Distribution/setMoney');?>"><i class="fa fa-circle-o"></i> 奖金配置</a></li>
                    <li class="<?php if(ACTION_NAME == memberList): ?>active<?php endif; ?>"><a href="<?php echo U('Distribution/memberList');?>"><i class="fa fa-circle-o"></i> 分销人员列表</a></li>
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="/Admin/Poster/index"><i class="fa fa-circle-o"></i> 微信生成海报设置</a></li>
                </ul>
            </li>


            <li class="header">备注</li>
            <li class="treeview <?php if(CONTROLLER_NAME == Bills or CONTROLLER_NAME == index): ?>active<?php endif; ?>">
                <a href="<?php echo U('Bills/index');?>"><i class="fa fa-circle-o text-red"></i> <span>结算账单</span></a>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == QgsBills or CONTROLLER_NAME == index): ?>active<?php endif; ?>">
                <a href="<?php echo U('QgsBills/index');?>"><i class="fa fa-circle-o text-red"></i> <span>全国送抽佣账单</span></a>
            </li>
        </ul>
    </section>
    <!-- /.sidebar -->
</aside>

<?php
}elseif(session('userInfo')['type'] == 2){ ?>

<aside class="main-sidebar">
    <section class="sidebar">
        <!-- 导航页面 -->
        <ul class="sidebar-menu">

<?php
 foreach ($nav_menu as $k=>$v) { switch ($k) { case 0: $iClass = 'fa-dashboard'; break; case 1: $iClass = 'fa-th'; break; case 2: $iClass = 'fa-laptop'; break; case 3: $iClass = 'fa-edit'; break; case 4: $iClass = 'fa-table'; break; case 5: $iClass = 'fa-folder'; break; default: $iClass = 'fa-dashboard'; } ?>
            <li class="treeview">
                <a href="#">
                    <i class="fa <?php echo $iClass; ?>"></i> <span><?php echo $v['name'];?></span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <?php
 foreach ($menu as $value) { if($v['id'] == $value['nav_menu_id']) { ?>
                    <li><a href="<?php echo $value['value']; ?>"><i class="fa fa-circle-o"></i> <?php echo $value['name']?></a></li>
                    <?php }} ?>
                </ul>
            </li>
<?php } ?>
        </ul>
        <script type="text/javascript">
			var curHref = window.location.href.toLowerCase();
			$(".sidebar-menu .treeview-menu a").each(function(){
				if(curHref.indexOf($(this).attr("href").toLowerCase()) != -1){
					$(this).parents(".treeview").addClass("active");
					$(this).parent().addClass("active");
				}	
			});
		</script>
    </section>
    <!-- /.sidebar -->
</aside>
<?php } ?>

<link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap-switch.min.css">
<link href="/Public/admin/printer/css/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/admin/printer/css/bootstrap.css" rel="stylesheet" type="text/css" />

<!-- 加载打印预览-->

<!-- 加载jq-->
<script src='/Public/admin/printer/js/jquery-1.10.2.min.js'></script>
<script src='/Public/admin/printer/js/jquery-ui.min.js'></script>
<style>
    /* wrap */
    .warp{
        width:99%;
        padding: 15px;
        height: auto;
    }
    .set{
        position:relative;
        width: 100%;
        height: auto;
        overflow: hidden;
        padding: 15px 0;
        display: flex;
        background: -webkit-linear-gradient(rgba(31, 130, 38, 0.48), #6d9870); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(rgba(31, 130, 38, 0.48), #6d9870);; /* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(rgba(31, 130, 38, 0.48), #6d9870); /* Firefox 3.6 - 15 */
        background: linear-gradient(rgba(31, 130, 38, 0.48), #6d9870); /* 标准的语法 */
    }

    .select-wrapper{
        margin: 0 15px;
        height: 28px;
        overflow: hidden;
    }
    .select-wrapper .label{
        font-size: 13px;
        height: 28px;
        overflow: hidden;
        line-height:28px ;
    }
    .select-wrapper select{
        font-size: 13px;
        height: 28px;
    }
    .select-wrapper input[type=text]{
        font-size: 13px;
        padding-left: 12px;
        height: 28px;
        overflow: hidden;
        line-height:28px ;
    }
    .select-wrapper input[type=checkbox]{
       position: relative;
        top:3px;
    }
    .imgUplod{
        display: block;
        position: relative;
    }
    .imgUplod .label{
        display: block;
        float: left;
        font-size: 13px;
        margin-top: 5px;
    }
    .imgUplod .a-upload {
        padding: 4px 10px;
        height: 28px;
        line-height: 20px;
        position: relative;
        cursor: pointer;
        color: #888;
        background: #fafafa;
        border: 1px solid #ddd;
        border-radius: 4px;
        overflow: hidden;
        display: inline-block;
        *display: inline;
        *zoom: 1
    }

    .imgUplod .a-upload  input {
        position: absolute;
        font-size: 13px;
        right: 0;
        top: 0;
        opacity: 0;
        filter: alpha(opacity=0);
        cursor: pointer
    }

    .imgUplod .a-upload:hover {
        color: #444;
        background: #eee;
        border-color: #ccc;
        text-decoration: none
    }


    .order-content{
        position:relative;
        width:100%;
        height:500px;
        overflow: hidden;
        border:1px solid #1B6D85;
        padding: 15px;
        margin-bottom: 15px;
        background: -webkit-linear-gradient(180deg,rgba(179, 236, 223, 0.48), rgba(159, 216, 169, 0.23)); /* Safari 5.1 - 6.0 */
        background: -o-linear-gradient(180deg,rgba(179, 236, 223, 0.48), rgba(159, 216, 169, 0.23));/* Opera 11.1 - 12.0 */
        background: -moz-linear-gradient(180deg,rgba(179, 236, 223, 0.48), rgba(159, 216, 169, 0.23)); /* Firefox 3.6 - 15 */
        background: linear-gradient(180deg,rgba(179, 236, 223, 0.48), rgba(159, 216, 169, 0.23)); /* 标准的语法 */
    }
    .upload_pic{
        position: absolute;
        right:-90px;
        top:0;
        padding: 4px 10px;
        height: 28px;
        line-height: 20px;
        cursor: pointer;
        color: #888;
        background: #fafafa;
        border: 1px solid #ddd;
        border-radius: 4px;
        overflow: hidden;
        display: inline-block;
        *display: inline;
        *zoom: 1
    }
</style>

<!-- 内容页 -->
<div class="content-wrapper">
    <div class="warp">
        <div id='set' class="set">
            <div id='select-wrapper' class="select-wrapper">
                <span class="label">添加快递单信息:</span>
                <select id='select'>
                    <option data-id=0   value=''>添加打印选项</option>
                    <?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$Item): $mod = ($i % 2 );++$i;?><option data-id=<?php echo ($i); ?> value='<?php echo ($key); ?>' data-title="<?php echo ($Item); ?>"><?php echo ($Item); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </div>
            <div class="select-wrapper">
                <span class="label">快递单名称:</span>
                <input type='text' id="prt_tmpl_title" value="<?php echo ($ss['prt_tmpl_title']); ?>">
            </div>
            <div class="select-wrapper">
                <span class="label">是否启用:</span>
                <input type="checkbox" value="true" id="shortcut" <?php if($ss['shortcut'] == 'true'): ?>checked="checked"<?php endif; ?> />
            </div>

            <div class="imgUplod">
                <span class="label">上传快递单背景图:</span>
                 <a href="javascript:;" class="a-upload"><input type="file" name="" id='choose-pic'>添加图片</a>
                 <a id="upload_pic" class="upload_pic" href="javascript:void(0)">上传图片</a>
                 <input type="hidden" name="pic_url" value="<?php echo ($ss['pic_url']); ?>" id="isUP">
            </div>
        </div>

        <input type="hidden" value="<?php echo ($ss['prt_tmpl_id']); ?>" name="prt_tmpl_id" id="is_tmpl_id"/>
        <?php if($ss['prt_tmpl_data'] != ''): ?><input type="hidden" value='<?php echo ($ss["prt_tmpl_data"]); ?>'  id="isxr"/><?php endif; ?>
         <div id='content' class='ui-widget-content order-content' style="width: <?php echo ($ss['prt_tmpl_width']); ?>px; height: <?php echo ($ss['prt_tmpl_height']); ?>px;background-image: url('<?php echo ($ss["pic_url"]); ?>'); background-size: cover;">
    </div>
    <a id='submit-info' class="btn btn-default" href='javascript:void(0)'>保存</a>
    <!--<a id='preview' class="btn btn-default" href='javascript:void(0)'>预览</a>-->

</div>

</div>
<!-- 底部 -->
<footer class="main-footer">
    <div class="pull-right hidden-xs">
        <b>Version</b> 3.0
    </div>
    <strong>Copyright &copy; 2016-2018 <a href="#">怡臣</a>.</strong> All rights
    reserved.
</footer>
</div>
<!-- Bootstrap 3.3.6 -->
<script src="/Public/admin/adminlte/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/Public/admin/adminlte/dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="/Public/admin/adminlte/dist/js/demo.js"></script>
<script src="/Public/admin/adminlte/plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript">
    $('.grid-refresh').click(function () {
        window.location.reload();
    });
    $('.gobackpage').click(function () {
        window.history.back();
    })
</script>
</body>
</html>
<script src="/Public/admin/adminlte/bootstrap/js/bootstrap-switch.min.js"></script>
<script>
    $(function(){
        $('#upload_pic').on('click',function(){
            var file=$('#choose-pic')[0].files;
            if(file.length==0){
                alert('请选择图片');
                return;
            }
            var fileUpload=file[0];
            var fd=new FormData();
            fd.append('fileUpload',fileUpload);
            $.ajax({
                url:'/Admin/Upload/index',
                type:'post',
                data:fd,
                contentType:false,
                processData:false,
                success:function(data){
                  var  datanew= eval("("+ data +")");
                    console.log(datanew);
                    var path='/Uploads/'+datanew;
                    //重新调用的话，图片显示不出来
                    $("#content").css({"background-image":"url("+path+")","background-size":"cover"});
                    $("#isUP").val(path);
                },
                error:function(){
                    alert('文件上传失败');
                }
            })
        })

        var i=0;

        var isxr = $('#isxr').val();

        if(isxr != null){
            //渲染

            //console.log(isxr);
           var Xr = JSON.parse(isxr);
          // console.log(Xr);

            for(var i1=0;i1<Xr.length;i1++){
                    //console.log(Xr[i1]+'/////');
                    var oDiv=$('<div>').addClass('info').data('keyword',Xr[i1]['keyword']).data('index',i++).data('id',$('option:selected',this).data('id')).addClass('ui-widget-content').appendTo('#content').resizable().draggable({containment: "#content"}).css({'min-width':'200px','min-height':'32px','padding':'5px','z-index':'','position':'absolute'});
                    oDiv.css({'width':Xr[i1]['width']+'px','height':Xr[i1]['height'],'top':Xr[i1]['y']+'px','left':Xr[i1]['x']+'px'});
                    //console.log($Xr[i]['keyword']);
                    var oKey=$('<span>').addClass('key-name').text(Xr[i1]['keyname']).appendTo(oDiv);
                    if(Xr[i1]['bold']=='true'){
                        oKey.css({'font-weight':'bold'});
                    }
                    oKey.css({'font-size':Xr[i1]['size']});

                  //  $('#content').css({'width':})

                    $('<a>').addClass('info-edit').text('编辑').css({'font-size':'12px','position':'absolute','right':'10px','top':'5px'}).attr('href','javascript:void(0)').appendTo(oDiv);

                    var oEditBox=$('<div>').addClass('edit-box').css({'padding':'12px 12px','height':'200px','border':'1px solid #ddd','z-index':'9','position':'absolute','position':'absolute','right':'-200px','top':'0px','background':'#fff'}).hide().appendTo(oDiv);

                    var oSize=$('<div>').css({'width':'100%','padding':'5px 0','margin-top':'30px'}).appendTo(oEditBox);
                    $('<span>').text('字体大小：').appendTo(oSize);

                    $('<input type="number">').addClass('size-num').css({'border':'1px solid #ddd','width':'55px','padding':'0 0 0 5px','margin-right':'5px'}).val(Xr[i1]['size']).appendTo(oSize);
                    $('<span>').text('px').appendTo(oSize);

                    var oFont=$('<div>').css({'width':'100%','padding':'5px 0',}).appendTo(oEditBox);
                    $('<span>').text('字体样式：').appendTo(oFont);
                    var oFontSelect=$('<select>').addClass('font-style').appendTo(oFont);
                    $('<option>').val('SimSun').text('宋体').appendTo(oFontSelect);
                    $('<option>').val('SimHei').text('黑体').appendTo(oFontSelect);
                    $('<option>').val('FangSong').text('仿宋').attr('selected',true).appendTo(oFontSelect);
                    $('<option>').val('KaiTi').text('楷体').appendTo(oFontSelect);
                    $('<option>').val('Microsoft YaHei').text('微软雅黑体').appendTo(oFontSelect);

                    var oBold=$('<div>').css({'width':'100%','padding':'5px 0',}).appendTo(oEditBox);
                    $('<span>').text('是否加粗：').appendTo(oBold);
                    $('<input type="checkbox">').addClass('is-bold').attr('checked',true).appendTo(oBold);
                    $('<a>').addClass('info-remove btn btn-sm btn-default').text('移除该项').css({'position':'absolute','bottom':'12px','left':'67px'}).attr('href','javascript:void(0)').appendTo(oEditBox);
                    $('<img src="/Public/admin/printer/images/iconClose.png" />').attr('href','javascript:void(0)').addClass('cancel-edit').css({'position':'absolute','top':'12px','right':'12px','width':'15px','height':'15px','cursor': 'pointer'}).appendTo(oEditBox);
                    $('<a>').attr('href','javascript:void(0)').addClass('save-edit  btn btn-sm btn-default').css({'position':'absolute','bottom':'12px','left':'12px'}).text('保存').appendTo(oEditBox);

                    $(this).val('');

            }

        }
        $('#content').resizable();
        $('body').on('click','.info-remove',function(){
            $(this).parents('.info').remove();
            //console.log($(this).text());
        });
        $('body').on('click','.info-edit',function(){
            //console.log($(this).text());
            $(this).siblings('.edit-box').show();
        });
        $('body').on('click','.cancel-edit',function(){
            $(this).parent().hide();
        });

        $('body').on('click','.save-edit',function(){
            var size=$(this).parents('.edit-box').find('.size-num').val()+'px';
            var style=$(this).parents('.edit-box').find('.font-style').val();
            var bold=$(this).parents('.edit-box').find('.is-bold')[0].checked;
            //console.log(size+'/'+style+'/'+bold);

            $(this).parents('.info').find('.key-name').css({'font-family':style,'font-size':size});
            if(bold){
                $(this).parents('.info').find('.key-name').css('font-weight','bold');
            }
            $(this).parent().hide();
        });

        $('#select').val('');
        $('#select').on('change',function(){
            //生成一条信息
            //alert($('option:selected',this).data('id'));
            var $oDiv =$('<div>').addClass('info').data('keyword',$(this).val()).data('index',i++).data('id',$('option:selected',this).data('id')).addClass('ui-widget-content').appendTo('#content').resizable().draggable({containment: "#content"}).css({'min-width':'200px','min-height':'32px','padding':'5px','position':'absolute'});
            var $oKey=$('<span>').addClass('key-name').text($('option:selected',this).text()).appendTo($oDiv);

            $('<a>').addClass('info-edit').text('编辑').css({'font-size':'12px','position':'absolute','right':'10px','top':'5px'}).attr('href','javascript:void(0)').appendTo($oDiv);

            var $oEditBox=$('<div>').addClass('edit-box').css({'padding':'12px 12px','height':'200px','border':'1px solid #ddd','position':'absolute','right':'-200px','top':'0px','background':'#fff'}).hide().appendTo($oDiv);

            var $oSize=$('<div>').css({'width':'100%','padding':'5px 0','margin-top':'30px'}).appendTo($oEditBox);
            $('<span>').text('字体大小：').appendTo($oSize);
            $('<input type="number">').addClass('size-num').css({'border':'1px solid #ddd','width':'55px','padding':'0 0 0 5px','margin-right':'5px'}).val(12).appendTo($oSize);
            $('<span>').text('px').appendTo($oSize);

            var $oFont=$('<div>').css({'width':'100%','padding':'5px 0',}).appendTo($oEditBox);
            $('<span>').text('字体样式：').appendTo($oFont);
            var $oFontSelect=$('<select>').addClass('font-style').css({'border':'1px solid #ddd'}).appendTo($oFont);
            $('<option>').val('SimSun').text('宋体').appendTo($oFontSelect);
            $('<option>').val('SimHei').text('黑体').appendTo($oFontSelect);
            $('<option>').val('FangSong').text('仿宋').attr('selected',true).appendTo($oFontSelect);
            $('<option>').val('KaiTi').text('楷体').appendTo($oFontSelect);
            $('<option>').val('Microsoft YaHei').text('微软雅黑体').appendTo($oFontSelect);

            var $oBold=$('<div>').css({'width':'100%','padding':'5px 0',}).appendTo($oEditBox);
            $('<span>').text('是否加粗：').appendTo($oBold);
            $('<input type="checkbox">').css({'border':'1px solid #ddd','width':'15px','height':'15px','position':'relative','top':'2px'}).addClass('is-bold').attr('checked',false).appendTo($oBold);

            $('<a>').addClass('info-remove btn btn-sm btn-default').text('移除该项').css({'position':'absolute','bottom':'12px','left':'67px'}).attr('href','javascript:void(0)').appendTo($oEditBox);
            $('<a> <img src="images/iconClose.png" />').attr('href','javascript:void(0)').addClass('cancel-edit').css({'position':'absolute','top':'5px','right':'12px','width':'15px','height':'15px'}).appendTo($oEditBox);
            $('<a>').attr('href','javascript:void(0)').addClass('save-edit  btn btn-sm btn-default').css({'position':'absolute','bottom':'12px','left':'12px'}).text('保存').appendTo($oEditBox);

            $(this).val('');
        });
        $('#submit-info').on('click',function(){
            var data=new Object();
            data['wrap']=new Object();
            data['info']=new Object();
            data['wrap']['width']=$('#content').width();
            data['wrap']['height']=$('#content').height();
            data['wrap']['prt_tmpl_id']=$('#is_tmpl_id').val();
            data['wrap']['pic_url']=$('#isUP').val();
            //console.log($('#is_tmpl_id').val());
            data['wrap']['prt_tmpl_title']=$('#prt_tmpl_title').val();
            data['wrap']['shortcut']=$(this).parents().find("input[type=checkbox]:checked").val();
            $('.info').each(function(idx){
                data['info'][idx]=new Object();
                data['info'][idx]['x']=$(this).position().left;
                data['info'][idx]['y']=$(this).position().top;
                data['info'][idx]['keyname']=$(this).find('.key-name').text();
                data['info'][idx]['keyword']=$(this).data('keyword');
                data['info'][idx]['width']=$(this).width();
                data['info'][idx]['height']=$(this).height();
                data['info'][idx]['size']=$(this).find('.key-name').css('font-size');
                data['info'][idx]['family']=$(this).find('.key-name').css('font-family');
                data['info'][idx]['bold']=($(this).find('.key-name').css('font-weight')=='bold')?'true':'false';
            })
            //console.log(data);
            $.ajax({
                url:'/admin/Delivery/savePrint',
                type:'post',
                dataType:'json',
                data:{'data':data},
                success:function(data){
                        alert(data.msg);
                },
                error:function(){
                    alert('保存失败');
                }
            })
        });
        $('#preview').on('click',function(){
           
        })


    })
</script>